<div class="block_head">
    <div class="bheadl"></div>
    <div class="bheadr"></div>
    <h2>Log de Horas</h2>
    <ul>
        <li><?php echo $this->Html->link('ADICIONAR', '/horas/add/'); ?></li>
    </ul>
</div>
<div class="block_content">
    <table width="100%" cellspacing="0" cellpadding="0">

        <tbody>
            <tr>
                <!--td width="10"><input type="checkbox" class="check_all"></td-->
                <th><?php echo $paginator->sort('Nome', 'nome') ?></th>
                <th><?php echo $paginator->sort('Inicio', 'inicio') ?></th>
                <th><?php echo $paginator->sort('Fim', 'fim') ?></th>
                <th><?php echo $paginator->sort('Total', 'total') ?></th>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <?php
            foreach ($horas as $hora) {
                $projeto_string = null;
                if ($hora['Tarefa']['projeto_id'] != '') {
                    $projeto_info = $projetos[$hora['Tarefa']['projeto_id']];
                    $infos = array_keys($projeto_info);

                    $projeto_string = $this->Html->link(
                            $infos[0],
                            '/projetos/view/' . $hora['Tarefa']['projeto_id'],
                            array(
                                'style' => 'padding: 2px; margin-left: 5px; background-color: ' . $projeto_info[$infos[0]]
                    ));
                    //debug($projeto_info);
                }
            ?>
                <tr>
                    <!--td><input type="checkbox"></td-->
                    <td><?php echo $hora['Tarefa']['nome'] . $projeto_string; ?></td>
                    <td><?php echo $hora['Hora']['inicio']; ?></td>
                    <td><?php echo $hora['Hora']['fim']; ?></td>
                    <td><?php echo $hora['Hora']['total']; ?></td>
                    <td class="delete"><?php echo $this->Html->link('Editar', '/horas/edit/' . $hora['Hora']['id']); ?></td>
                    <td class="delete"><?php echo $this->Html->link('del', '/horas/del/' . $hora['Hora']['id']); ?></td>
                </tr>
            <?php } //foreach clientes  ?>
        </tbody>
    </table>
    <?php echo $this->Element('pagination'); ?>
</div>
